#include "gamestatistic.h"

GameStatistic::GameStatistic()
{
    atBats=0;
    singles=0;
    doubles=0;
    triples=0;
    grandSlams=0;
    homeruns=0;
    walks=0;
    strikeouts=0;
    runsScored=0;
    runsBattedIn=0;
    stolenBases=0;
    sacrificeFlys=0;

    //pitching stats
    walksPitched=0;
    earnedRuns=0;
    inningsPitched=0;
    strikeoutsPitched=0;
    wins=0;
    losses=0;
    hitsAllowed=0;
    atBatsFaced=0;

    //defensive
    errors=0;
}

GameStatistic::~GameStatistic(){
}

//offensive stat methods
int GameStatistic::getAtBats(){
    return atBats;
}

void GameStatistic::setAtBats(int inputAtBats){
    atBats=inputAtBats;
}

void GameStatistic::incrementAtBats(){
    atBats++;
}

int GameStatistic::getSingles(){
    return singles;
}

void GameStatistic::setSingles(int inputSingles){
    singles=inputSingles;
}

void GameStatistic::incrementSingles(){
    singles++;
}

int GameStatistic::getDoubles(){
    return doubles;
}

void GameStatistic::setDoubles(int inputDoubles){
    doubles=inputDoubles;
}

void GameStatistic::incrementDoubles(){
    doubles++;
}

int GameStatistic::getTriples(){
    return triples;
}

void GameStatistic::setTriples(int inputTriples){
    triples=inputTriples;
}

void GameStatistic::incrementTriples(){
    triples++;
}

int GameStatistic::getHomeRuns(){
    return homeruns;
}

void GameStatistic::setHomeRuns(int inputHomeruns){
    homeruns=inputHomeruns;
}

void GameStatistic::incrementHomeRuns(){
    homeruns++;
}

int GameStatistic::getHits(){
    return singles+doubles+triples+homeruns;
}

double GameStatistic::getBattingAverage(){
    return getHits()/atBats;
}

double GameStatistic::getOnBasePercentage(){
    return getHits()/(atBats+sacrificeFlys);
}

int GameStatistic::getRunsScored(){
    return runsScored;
}

void GameStatistic::setRunsScored(int inputRunsScored){
    runsScored=inputRunsScored;
}

void GameStatistic::incrementRunsScored(){
    runsScored++;
}

int GameStatistic::getRunsBattedIn(){
    return runsBattedIn;
}

void GameStatistic::setRunsBattedIn(int inputRunsBattedIn){
    runsBattedIn=inputRunsBattedIn;
}

void GameStatistic::incrementRunsBattedIn(){
    runsBattedIn++;
}

int GameStatistic::getStolenBases(){
    return stolenBases;
}

void GameStatistic::setStolenBases(int inputStolenBases){
    stolenBases=inputStolenBases;
}

void GameStatistic::incrementStolenBases(){
    stolenBases++;
}

int GameStatistic::getGrandSlams(){
    return grandSlams;
}

void GameStatistic::setGrandSlams(int inputGrandSlams){
    grandSlams=inputGrandSlams;
}

void GameStatistic::incrementGrandSlams(){
    grandSlams++;
}

int GameStatistic::getWalks(){
    return walks;
}

void GameStatistic::setWalks(int inputWalks){
    walks=inputWalks;
}

void GameStatistic::incrementWalks(){
    walks++;
}

int GameStatistic::getStrikeouts(){
    return strikeouts;
}

void GameStatistic::setStrikeouts(int inputStrikeouts){
    strikeouts=inputStrikeouts;
}

void GameStatistic::incrementStrikeouts(){
    strikeouts++;
}

//pitching stats
int GameStatistic::getWalksPitched(){
    return walksPitched;
}

void GameStatistic::setWalksPitched(int inputWalksPitched){
    walksPitched=inputWalksPitched;
}

void GameStatistic::incrementWalksPitched(){
    walksPitched++;
}

int GameStatistic::getEarnedRuns(){
    return earnedRuns;
}

void GameStatistic::setEarnedRuns(int inputEarnedRuns){
    earnedRuns=inputEarnedRuns;
}

void GameStatistic::incrementEarnedRuns(){
    earnedRuns++;
}

double GameStatistic::getInningsPitched(){
    return inningsPitched;
}

void GameStatistic::setInningsPitched(double inputInningsPitched){
    inningsPitched=inputInningsPitched;
}

void GameStatistic::incrementInningsPitched(){
    inningsPitched+=(1/3); //note innings are 3 outs, so when a pitcher gets through an out, count goes up by 1/3
}

double GameStatistic::getEarnedRunAverage(){
    return (earnedRuns*9)/inningsPitched;
}


int GameStatistic::getStrikeoutsPitched(){
    return strikeoutsPitched;
}

void GameStatistic::setStrikeoutsPitched(int inputStrikeoutsPitched){
    strikeoutsPitched=inputStrikeoutsPitched;
}

void GameStatistic::incrementStrikeoutsPitched(){
    strikeoutsPitched++;
}

int GameStatistic::getWins(){
    return wins;
}

void GameStatistic::setWins(int inputWins){
    wins=inputWins;
}

void GameStatistic::incrementWins(){
    wins++;
}

int GameStatistic::getLosses(){
    return losses;
}

void GameStatistic::setLosses(int inputLosses){
    losses=inputLosses;
}

void GameStatistic::incrementLosses(){
    losses++;
}

int GameStatistic::getHitsAllowed(){
    return hitsAllowed;
}

void GameStatistic::setHitsAllowed(int inputHitsAllowed){
    hitsAllowed=inputHitsAllowed;
}

void GameStatistic::incrementHitsAllowed(){
    hitsAllowed++;
}

int GameStatistic::getAtBatsFaced(){
    return atBatsFaced;
}

void GameStatistic::setAtBatsFaced(int inputAtBatsFaced){
    atBatsFaced=inputAtBatsFaced;
}

void GameStatistic::incrementAtBatsFaced(){
    atBatsFaced++;
}

double GameStatistic::getOpponentsBattingAverage(){
    return hitsAllowed/atBatsFaced;
}

int GameStatistic::getErrors(){
    return errors;
}

void GameStatistic::setErrors(int inputErrors){
    errors=inputErrors;
}

void GameStatistic::incrementErrors(){
    errors++;
}
